package com.example.com.skills_utf8;

import java.io.IOException;
import java.nio.charset.Charset;

import android.app.Activity;
import android.content.Intent;
import android.nfc.FormatException;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.tech.Ndef;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class NFCActivity extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_nfc);
		
		Button btn_read =(Button)findViewById(R.id.btn_read); //如果要支持后台模式, 如何保持高的优先级呢
		btn_read.setOnClickListener( new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
					Intent intent = new Intent(NFCActivity.this, ForegroundDispatch_nfc.class);
					startActivity(intent);
				
			}
		});
		
		Button btn_write =(Button)findViewById(R.id.btn_write);  // 前台模式
		btn_write.setOnClickListener( new OnClickListener() {
			
			@Override
			public void onClick(View v) { 
				// TODO Auto-generated method stub
				Intent intent = new Intent(NFCActivity.this, ForegroundDispatch_nfc1.class);
				startActivity(intent);
			}
		});
		
		
	}
	

	
	
	
}
